package com.cip.admin.service.impl;

import com.cip.admin.dao.LookupDao;
import com.cip.admin.model.LabelValue;
import com.cip.admin.model.Role;

import com.cip.admin.service.LookupManager;

import java.util.ArrayList;
import java.util.List;


/**
 * Implementation of LookupManager interface to talk to the persistence layer.
 *
 * @author <a href="mailto:matt@raibledesigns.com">Matt Raible</a>
 */
public class LookupManagerImpl implements LookupManager {
    LookupDao lookupDAO;

    /**
     * {@inheritDoc}
     */
    public List<LabelValue> getAllRoles() {
        List<Role> roles = lookupDAO.getRoles();
        List<LabelValue> list = new ArrayList<LabelValue>();

        for (Role role1 : roles) {
            list.add(new LabelValue(role1.getName(), role1.getName()));
        }

        return list;
    }

	public LookupDao getLookupDAO() {
		return lookupDAO;
	}

	public void setLookupDAO(LookupDao lookupDAO) {
		this.lookupDAO = lookupDAO;
	}
    
}
